﻿@model Mvc.Sample.Models.TodoItem
@{
	ViewData["Title"] = "Edit Item";
	Layout = "~/Views/Shared/_Layout.cshtml";
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>Edit Item</title>
    <link href="~/lib/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" />
</head>
<body>
<div class="container mt-4">
    <h2>Edit Item</h2>
    @using (Html.BeginForm("Edit", "Home", FormMethod.Post, new { @class = "form" }))
    {
        @Html.AntiForgeryToken()
        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
        <div class="form-group">
            @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "form-label" })
            <span class="text-danger">*</span> 
            @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" })
        </div>
        <div class="form-group">
            @Html.LabelFor(model => model.Description, htmlAttributes: new { @class = "form-label" })
            <span class="text-danger">*</span> 
            @Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => model.Description, "", new { @class = "text-danger" })
        </div>
        <div class="form-group form-check" mb-3>
            @Html.CheckBoxFor(model => model.IsDone, new { @class = "form-check-input" })
            @Html.LabelFor(model => model.IsDone, new { @class = "form-check-label" })
        </div>
        <div class="form-group">
            @Html.LabelFor(model => model.DueDate, new { @class = "control-label" })
            <span class="text-danger">*</span> 
            @Html.TextBoxFor(model => model.DueDate, "{0:yyyy-MM-dd}", new { @class = "form-control", type = "date" })
            @Html.ValidationMessageFor(model => model.DueDate, "", new { @class = "text-danger" })
        </div>
        <div class="form-group">
            <button type="submit" class="btn btn-primary">保存</button>
        </div>
    }
    <div>
        @Html.ActionLink("Back to List", "Index", "Home", new { @class = "btn btn-secondary" })
    </div>
</div>
<script src="~/lib/jquery/dist/jquery.js"></script>
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/dist/jquery.validate.unobtrusive.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
